UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JQqIpkNYQnXExP0f0XpV6maRItl/ryiKiVafV1G/9Fw='
WHERE
key_id = '409b4b92b32972647d254c9d82a0821f6fa45a43411ec7ac3abec682f176a76c'
AND (
token = 'JQqIpkNYQnXExP0f0XpV6maRItl/ryiKiVafV1G/9Fw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)