UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yn0MUvZOyvlWunI+GK44QHooRS70KmVDwzJ/SjuA38Q=' 
WHERE 
  key_id = 'dd453a8576b80b56980c23ee66719aa7c180ca0819873adb6dc19f9ef2398b9e' 
  AND (
    token = 'yn0MUvZOyvlWunI+GK44QHooRS70KmVDwzJ/SjuA38Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030