UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pAwZiwp9+4OHXIlxrrFyBCdFdK7iY5SPEYKBdDSXD9Y='
WHERE
key_id = 'afe1d92839aaf6830b4840289b47efa33290c66a3b4948beb8682a3a4be4388c'
AND (
token = 'pAwZiwp9+4OHXIlxrrFyBCdFdK7iY5SPEYKBdDSXD9Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)