UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9diYpF9lE5Vv9AkwGTI5+1GfTpyWoOEoyiyUjUAUKzM=' 
WHERE 
  key_id = '8ba4f723d352a22d17fd9971e660ce8ba292eb39c4684c59f076fdcc9ef22eaf' 
  AND (
    token = '9diYpF9lE5Vv9AkwGTI5+1GfTpyWoOEoyiyUjUAUKzM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037