UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NS8MT0lQq8MJYYV8C5mixcil0XU730ng3RroeVVvhYU='
WHERE
key_id = '39456c5136ea003bf55e05eb349bfcf84ceab0223feea845210847dc0a9748e8'
AND (
token = 'NS8MT0lQq8MJYYV8C5mixcil0XU730ng3RroeVVvhYU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)