UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZhUBm/TS6Ki44hFLWt/sVTHRlikIMjLCDD8+HcpgH1s=' 
WHERE 
  key_id = '31e0d656eef8876a50ffd357b12f76fb608f03c6a7be01605987776328ce574c' 
  AND (
    token = 'ZhUBm/TS6Ki44hFLWt/sVTHRlikIMjLCDD8+HcpgH1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036