UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E4R9mBgvCNWEspIZG2boOEZnuVhskf5WhuEinMHNMes=' 
WHERE 
  key_id = '007468356a2357bc273f946649253585367c70babcc999313edf315f30a5f9e1' 
  AND (
    token = 'E4R9mBgvCNWEspIZG2boOEZnuVhskf5WhuEinMHNMes=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029