UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NkWVtSNFUt9xW1iQG2qAEQouebwmlX3WvVUI7Q1thhI=' 
WHERE 
  key_id = '778756c24db2c6d2a3780e11b5ec99c6e8f811b3fa11bf2e1d92666919a8240a' 
  AND (
    token = 'NkWVtSNFUt9xW1iQG2qAEQouebwmlX3WvVUI7Q1thhI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044