UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'geUuPq/fe24AL6f1KeDAM0+96XpCj83fLqmQ8hQ+c8o=' 
WHERE 
  key_id = '6ab5eb033b58d1e14627837275684e420b643474912396bf98db4c7c81534765' 
  AND (
    token = 'geUuPq/fe24AL6f1KeDAM0+96XpCj83fLqmQ8hQ+c8o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029