UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3q08UF03r8b5OIeIk7VE9i6s7dbe5spWccF/Tt2PkVg='
WHERE
key_id = '3f7f5059c65bbf9791859560e9a6f16f0141ff0d9e42ab227ed384c29740f2fc'
AND (
token = '3q08UF03r8b5OIeIk7VE9i6s7dbe5spWccF/Tt2PkVg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)