UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IgFhqL4pXtpIHWJSKt1PfZchbbyALZ4FDL5t+MWKIPs=' 
WHERE 
  key_id = 'f4f55526532ced693191fa2b5c640f29f428339565416b3917332fdd43984cb6' 
  AND (
    token = 'IgFhqL4pXtpIHWJSKt1PfZchbbyALZ4FDL5t+MWKIPs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042