UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0KaYH6kxM5PCkemtxLeiI3dOQ/NVJO+U6/0Bgzfgihw='
WHERE
key_id = '9e6819ec382899bcac33258fa389f4f36564a1187f334a22876475876ec69df9'
AND (
token = '0KaYH6kxM5PCkemtxLeiI3dOQ/NVJO+U6/0Bgzfgihw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)