UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dBJ2CkTSCF/BMZJGj+Uzb+wWWs5bMbCAMHBOnVzGlYE=' 
WHERE 
  key_id = '9a612147103156bb053048596328c36e5eb5e1e25f98f65bfaad025c2f814ba4' 
  AND (
    token = 'dBJ2CkTSCF/BMZJGj+Uzb+wWWs5bMbCAMHBOnVzGlYE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047