UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IiNr+MWJYmzOiobYJkFD7N/3dFwPPRXQMNuH2nogOl0=' 
WHERE 
  key_id = '7e016fbb3013bb53d1a1ab1c68e53a0e5c64e6d136a33c415884c94f82ed9381' 
  AND (
    token = 'IiNr+MWJYmzOiobYJkFD7N/3dFwPPRXQMNuH2nogOl0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028