UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uw9xAHzJIYewAP6M6iAXUd+Ujkv5Hhm8cQhP7ocFKqM='
WHERE
key_id = '172ded4d376a1ddcfff2e522f4464e2b0bb093b91301f681b5d2ea817fed7b31'
AND (
token = 'uw9xAHzJIYewAP6M6iAXUd+Ujkv5Hhm8cQhP7ocFKqM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)