UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sAALLdx9joQP7BYTYMJFeLNw40ScbUwQNlTKijJM6/0=' 
WHERE 
  key_id = '3aa75409fc88daa20df9fe1f9225b38178bca3564b36b510d7b857b779633157' 
  AND (
    token = 'sAALLdx9joQP7BYTYMJFeLNw40ScbUwQNlTKijJM6/0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042