UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5YcFG9GcTlil9RKzR1H5h7Fpvsys5hu0JEkzXtfmSaA='
WHERE
key_id = '1b140aabf144249f367ce76e8e6c054c1bd51549359974f2673dd8b981579f01'
AND (
token = '5YcFG9GcTlil9RKzR1H5h7Fpvsys5hu0JEkzXtfmSaA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)