UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4kKGEhWlyqOTaRjLB10LTQAWZqb3xzg0LSIsPu6Uj7E=' 
WHERE 
  key_id = '2296ed7e9ca9a3fd0a727fe1329863daaa2a28862c8c4595b51f55ff82a99309' 
  AND (
    token = '4kKGEhWlyqOTaRjLB10LTQAWZqb3xzg0LSIsPu6Uj7E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034