UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XzQUNNCZRMsPuyAScF8AoSghRieuYqdD8sfCiwVsuy0='
WHERE
key_id = '3c58fb15a2076e2a603ff3501f48f07bb558c5dff259ec33be8915e71f931030'
AND (
token = 'XzQUNNCZRMsPuyAScF8AoSghRieuYqdD8sfCiwVsuy0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)