UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'USyR+UusaxMo8ySMVZFyJlAAtCXmUc2TlfQaWSr9Lbs=' 
WHERE 
  key_id = 'ec0515dddd4d902a913cd67c8cc981b4212da9d759fc83cf2d72040b6c34dedd' 
  AND (
    token = 'USyR+UusaxMo8ySMVZFyJlAAtCXmUc2TlfQaWSr9Lbs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029