UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uCX00OfXVUMN8MEwAyV1WMmXYWmwk507uFooTfQMnc0=' 
WHERE 
  key_id = '354ad9b0f60c95a553f66a06bcf7b0a5b157f4e6589a7fd5f9c0a23d648105fc' 
  AND (
    token = 'uCX00OfXVUMN8MEwAyV1WMmXYWmwk507uFooTfQMnc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037