UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FrRW0I3oEG4767EJ9Q9b2kn/XB4cXXhI2lwXuZAcFG0=' 
WHERE 
  key_id = '728f217663383edaadb68c98e4245314f711ac157cfd96c34b7eb5a3c2deb86f' 
  AND (
    token = 'FrRW0I3oEG4767EJ9Q9b2kn/XB4cXXhI2lwXuZAcFG0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032