UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x+gGcSQw1COB5Lv2mCUkUoGpJTIC6iVcZGb6WGk1Yk4=' 
WHERE 
  key_id = '757d39ebaf5fdcca351fff18a64c148d9fc3d6351375fc43db5fb391ebac15bf' 
  AND (
    token = 'x+gGcSQw1COB5Lv2mCUkUoGpJTIC6iVcZGb6WGk1Yk4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035