UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dJW+Tuym54mglTqn9I2szJEJ4XefzyJY6vlnWT52sCk=' 
WHERE 
  key_id = 'ecc2457112e700597c8533044fe6b0c14dd46a71614181d82bcd0de331bd1aff' 
  AND (
    token = 'dJW+Tuym54mglTqn9I2szJEJ4XefzyJY6vlnWT52sCk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025