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

Query time 0.00029