UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6YpOgWV4dRoUETA39x4CSggXHpjxdHioUxSeVXm3n78=' 
WHERE 
  key_id = '6297c817e29fded00c906df829665d9da5c1b625abf0d76dd2481a293d354266' 
  AND (
    token = '6YpOgWV4dRoUETA39x4CSggXHpjxdHioUxSeVXm3n78=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022