UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HYXsrnYnPRM4OtVuwMenFyCoZj21krPKhRwznsxR3hM=' 
WHERE 
  key_id = 'dbb912c744ac8137292150674966dd2b49e541b010fb89d0a9fa303d77a24eb6' 
  AND (
    token = 'HYXsrnYnPRM4OtVuwMenFyCoZj21krPKhRwznsxR3hM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054