UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Jk4LZ7L+tB5jzaN0fwMtUJH3/YJrHJTK4jZSyNKFgL4='
WHERE
key_id = 'a581d860a9087af06ef126a157fa7090f33de91b5245a3e52c3671ea7f63e702'
AND (
token = 'Jk4LZ7L+tB5jzaN0fwMtUJH3/YJrHJTK4jZSyNKFgL4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)