UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CpjFJrJUIMDgKDNsWjAYa9uQNW9mv1FUwbIvMAn+S1k='
WHERE
key_id = 'ad0fce5f43daa15f3e37afafe5a0c0e8bc6ab02aeb46cb89ce1992c320569699'
AND (
token = 'CpjFJrJUIMDgKDNsWjAYa9uQNW9mv1FUwbIvMAn+S1k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)