UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jV+Rqx+ubn5k38whEvxqzW7g/tO/0dcKUd8k87PTf9s=' 
WHERE 
  key_id = '111d3aafe5ee601ab64035852256fb2c73212e00130d089b31d96fd88b79e9b8' 
  AND (
    token = 'jV+Rqx+ubn5k38whEvxqzW7g/tO/0dcKUd8k87PTf9s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034