UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cYQil+4flfuE6qqv5LbAl/Y2GHVtvElyFLl94MXZPWo=' 
WHERE 
  key_id = '6a9e432bee87fb18d71304d6abc666de69bbb851b041bf664734794ff5e7e3e6' 
  AND (
    token = 'cYQil+4flfuE6qqv5LbAl/Y2GHVtvElyFLl94MXZPWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022