UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O9UNP60R9pOAoE0SNfSmsISvRj4KKwsJS9qVeIgHAcQ=' 
WHERE 
  key_id = '9936b99d838285b9e011e22756e7042307016de4a11f80b4022c4b4f80913d72' 
  AND (
    token = 'O9UNP60R9pOAoE0SNfSmsISvRj4KKwsJS9qVeIgHAcQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034