UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kly3/3HfpqukOWQAIHUia6iBgkZSSLP4v44GXTFouEM=' 
WHERE 
  key_id = '699f6dca99c2692e8fe773c56720ead4d9837617b380f0215d8cff99c8e2ee8d' 
  AND (
    token = 'Kly3/3HfpqukOWQAIHUia6iBgkZSSLP4v44GXTFouEM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039