UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lD0HHLL2x9e1bm/RavIl8nHtatPg6ObPuAb1gAhJ/jI=' 
WHERE 
  key_id = 'b637ca089e3a303e2dab948fd6f28c10bda4d8c017e3992ddddf97edc5032274' 
  AND (
    token = 'lD0HHLL2x9e1bm/RavIl8nHtatPg6ObPuAb1gAhJ/jI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028