UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dGxeYEO1ru/BnjetgDqPANsFRIK9NiwPJAnsGSevavM=' 
WHERE 
  key_id = '6aacbc9606388ea3b6b448c55131378c8322fc55a9266dcd0f94f26ecd90daec' 
  AND (
    token = 'dGxeYEO1ru/BnjetgDqPANsFRIK9NiwPJAnsGSevavM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024