UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xLD931nlwBz7jv2+eFg/qNfH8gZAaycfSWwFZXG9UEk='
WHERE
key_id = 'ae57b50f98ebc2004f6ad102c38e8d2f43aabcce3951ae9ee43e9afbf68e5d4e'
AND (
token = 'xLD931nlwBz7jv2+eFg/qNfH8gZAaycfSWwFZXG9UEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)