UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EouMrXwIdJvMRQpF+H9y2F9OTPKrtRjpXZWBgotyZ6M=' 
WHERE 
  key_id = '8f2044663fc1b7d9a35eb225a014d77e6c98ff24ca5c8f4a45e6759b97dc073b' 
  AND (
    token = 'EouMrXwIdJvMRQpF+H9y2F9OTPKrtRjpXZWBgotyZ6M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027