UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X7s6Rt5H5LB7YsVyPqDHc3dkT9rR7JrYVnKK16HlE+U=' 
WHERE 
  key_id = '371d49be30f334d0f5fd6585da1cbb296585d5aa57007921ceea2423db3d52ad' 
  AND (
    token = 'X7s6Rt5H5LB7YsVyPqDHc3dkT9rR7JrYVnKK16HlE+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022