UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H3ai91omAq+AIi40u2wVNaZxtqmrq+ZMRDMd6heYfUo=' 
WHERE 
  key_id = 'cfa34eb66fd7f1cb4b694665a91fb697e3884b50b5c2e7f9a3383fe68d9c86ee' 
  AND (
    token = 'H3ai91omAq+AIi40u2wVNaZxtqmrq+ZMRDMd6heYfUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034