UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uVCQQf9Rq3aYfgCZPSotbBll3IKLSO7MRStT7yxszpE='
WHERE
key_id = 'b6177e2f77bbda024c74db24d264dff89d3d459f102ca64394d176d424059b40'
AND (
token = 'uVCQQf9Rq3aYfgCZPSotbBll3IKLSO7MRStT7yxszpE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)