UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G87QbxwLUyeQthXggnHO/M2VkO9EoRg/xvBX4M661oU=' 
WHERE 
  key_id = '1ef2c5c3086c5ffe23eeb260f34b45fe65e1280607692009fb4326ac55f5f9af' 
  AND (
    token = 'G87QbxwLUyeQthXggnHO/M2VkO9EoRg/xvBX4M661oU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048