UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rc6WmUm+oyvWkM5RWF1VeolWr2wm3abN8bh+vaJbHxk=' 
WHERE 
  key_id = 'c9fd07349a3dd3ff29e8da1acd8b867029852a38778fa8b594cf1da67f0fcbea' 
  AND (
    token = 'Rc6WmUm+oyvWkM5RWF1VeolWr2wm3abN8bh+vaJbHxk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048