UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ylENZv95ZzulhqDzh2aIHgME2IMvyybuveuGBPzstFE=' 
WHERE 
  key_id = 'daa9a43ca42e373eb3e54042d03cb8ccb412b3316b2d91fe5b853c4006adc4d9' 
  AND (
    token = 'ylENZv95ZzulhqDzh2aIHgME2IMvyybuveuGBPzstFE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017