UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pK9afNnLrmWdbVN8noX99ToaX1VeU+9//2M/OgqcYXM='
WHERE
key_id = 'a986108b06d9b54fd1249981d7946fd0a3707579a275d26d2edcd3c134f46c89'
AND (
token = 'pK9afNnLrmWdbVN8noX99ToaX1VeU+9//2M/OgqcYXM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)