UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f6oE40HltKQ4xyZ1SS5GhW/QO0mmPxKeOdkhfV49qbc=' 
WHERE 
  key_id = '2c4e89a3a5c7a3500026dacc37f968c865a3c1c87fde6a21405c66bda1d7ce35' 
  AND (
    token = 'f6oE40HltKQ4xyZ1SS5GhW/QO0mmPxKeOdkhfV49qbc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032