UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B9usmvCmGFEBypHRIdEMH3KyeNHotjSScKEB19pilkk=' 
WHERE 
  key_id = 'd4519d1e7e1d292669837c0fac5e75874e2bdb84f9c3e29697bdc8066aaf0f92' 
  AND (
    token = 'B9usmvCmGFEBypHRIdEMH3KyeNHotjSScKEB19pilkk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028