UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ALnbJVFZfVCVf5j0v1jUNNAIZWrtqMYuhzuqY2cNBYw=' 
WHERE 
  key_id = '3294a609d4d37660e64bb10e8fb8aeb3e1433300b591b0eac4965ef229c8427e' 
  AND (
    token = 'ALnbJVFZfVCVf5j0v1jUNNAIZWrtqMYuhzuqY2cNBYw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052