UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B1cJiNhCQqR5vGwoo9xhCSzw+JuPULn4a3d1zjA3waw='
WHERE
key_id = '6922cd53bb143cf07db7ce1dfd1b566069adac8be667e600504b1c9a2483eac1'
AND (
token = 'B1cJiNhCQqR5vGwoo9xhCSzw+JuPULn4a3d1zjA3waw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)