UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KsBTEPglUpY6qUTTCLeTEBM/e7U+4IELKWvy40DWrTU=' 
WHERE 
  key_id = '62b93bda1bc7ede2b93a11e6f0cbb189e5727906558d243f25cc9a9da3bb1a07' 
  AND (
    token = 'KsBTEPglUpY6qUTTCLeTEBM/e7U+4IELKWvy40DWrTU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038