UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zTDKiZgoTGdxqffY1BBDvcDHHDX/aGb5MrrCBTC4r/k=' 
WHERE 
  key_id = '9e608c84ac34816f71c8560ffa6c26b8f59514c50d03ac6d54773e1acc76d48d' 
  AND (
    token = 'zTDKiZgoTGdxqffY1BBDvcDHHDX/aGb5MrrCBTC4r/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032