UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y7vgWq7r/4NJirirC8VLyA4IZTfnhFWgk9YNe2Z+HcE=' 
WHERE 
  key_id = '5eee420663f42b6396d564472f8aa58907a1fb0121b1e04af8ab220455fdf2b9' 
  AND (
    token = 'Y7vgWq7r/4NJirirC8VLyA4IZTfnhFWgk9YNe2Z+HcE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036