UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'voottZJm301szkXcDqxTonbhiNXTDRA946dzoPdFr5E='
WHERE
key_id = 'bf817ac830f8472fea107964711086110104555fc5c6bacdfab7656c5d9d25aa'
AND (
token = 'voottZJm301szkXcDqxTonbhiNXTDRA946dzoPdFr5E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)