UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9gzBQFtHWfQcHrKY5ZHtWUgNeyVAgbhF1pCf6qiEuvw='
WHERE
key_id = 'b5846e861661d2b55317863d32304a14ec504fdf54c5ccf4d70d42a2706041a9'
AND (
token = '9gzBQFtHWfQcHrKY5ZHtWUgNeyVAgbhF1pCf6qiEuvw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)