UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S6KIyt20sh3gyi4bJOJk2LJaF8laKTkZ8qMW/Fj+tgI='
WHERE
key_id = '360bc1895d3738e8f429457c8953896d09543ed97682231937de9fa3ff250a4b'
AND (
token = 'S6KIyt20sh3gyi4bJOJk2LJaF8laKTkZ8qMW/Fj+tgI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)