UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'loWHJ0K6pqbkM2DwGuOAkOEy2x2RyGZI3y9/cBs63Po=' 
WHERE 
  key_id = '9ff6c42ac728a244fd06dc5220a102fba3df00b28d65dbe60db70f165cd60fc0' 
  AND (
    token = 'loWHJ0K6pqbkM2DwGuOAkOEy2x2RyGZI3y9/cBs63Po=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030