UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mb5rEuU1RInGiLct1+ekNm4wddMlenPLIlxHH15tRVc=' 
WHERE 
  key_id = '39f1df05f660067465a59b99e126ac76e279dc5f0768fb60a9ed76fbd732ffa0' 
  AND (
    token = 'Mb5rEuU1RInGiLct1+ekNm4wddMlenPLIlxHH15tRVc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054