UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n11+r7s50PYb7xBj8g+JNAZLztQUU0clAKC+Qo6IA/E=' 
WHERE 
  key_id = '2066f8db272bee5c6061c20d7c009fdbf1c9e18c72db412fb5ac0aad70336b7b' 
  AND (
    token = 'n11+r7s50PYb7xBj8g+JNAZLztQUU0clAKC+Qo6IA/E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046