UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NAtklmEm+lgnZuihqRPb7y7Qf8oOnBpcB2fTk8wEnPc=' 
WHERE 
  key_id = 'ff6e825d41e476b503f2e34be75ab41d882e1d7a455c5fa0a7706a19b61f4761' 
  AND (
    token = 'NAtklmEm+lgnZuihqRPb7y7Qf8oOnBpcB2fTk8wEnPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046