UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OC8QETAdrxoCvsu8dLhZ6bWjhSouqR2+EbxVchWBEfI=' 
WHERE 
  key_id = 'f2e4382693f6f2173d921c42711dfc4f51cb3cc99e0144c6293c3cd56f3c4324' 
  AND (
    token = 'OC8QETAdrxoCvsu8dLhZ6bWjhSouqR2+EbxVchWBEfI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039