UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hOSdzfg33Pe1irifpsLUA2xnwnr0c2L3Z/+PYfHwMHU=' 
WHERE 
  key_id = '45f7d706654ae7c7146d59c80b1afa71333bfec5d646a5c5ba263d0fcfa9cf7f' 
  AND (
    token = 'hOSdzfg33Pe1irifpsLUA2xnwnr0c2L3Z/+PYfHwMHU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047