UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sdBLP2GD0NtO5/FnSmIeNLdZIC0MbmKmlRHZunF1+Ow=' 
WHERE 
  key_id = 'e66a70f0edf6670c2f541c95c3278322d65d1833325f691e0c50a72090f7760a' 
  AND (
    token = 'sdBLP2GD0NtO5/FnSmIeNLdZIC0MbmKmlRHZunF1+Ow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025